<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page language="java" import="com.tjtt.common.utils.DateUtilsAll"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<base target="_self" />
<link rel="stylesheet" type="text/css"
	href="<%=path%>/web/style/layout.css" />
<script type="text/javascript"
	src="<%=path%>/jqGrid/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript"
	src="<%=path%>/jslib/jquery.validate.min.js"></script>
<script type='text/javascript'
	src="<%=request.getContextPath()%>/jslib/My97DatePicker/WdatePicker.js"
	defer="defer"></script>
<script type='text/javascript'
	src="<%=request.getContextPath()%>/jslib/jquery.form.js"></script>
<script type="text/javascript"
	src="<%=request.getContextPath()%>/jslib/additional-methods.js"></script>
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/themes/default/easyui.css">
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/themes/icon.css">
<link rel="stylesheet" type="text/css"
	href="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/demo.css">
<script type="text/javascript"
	src="<%=request.getContextPath()%>/jslib/jquery-easyui-1.4.1/jquery.easyui.min.js"></script>
<c:if test="${requestScope.message!=null}">
	<script type="text/javascript">
		alert('<c:out value="${requestScope.message}"></c:out>');
		window.close();
	</script>
</c:if>

<script type="text/javascript">
var api = frameElement.api, W = api.opener;
var stateValue="";
$().ready(function(){
        var actionUrl = '<%=request.getContextPath() %>/Shebeifengcun!shebeiFlowFaqi.action?steptype='+$("#steptype0").val();		
		var options = {
	  	    url:actionUrl,
	  	     beforeSubmit: function() {
	   				return checking();
	    			},
	  	    dataType:'json',
	  	    success: function(data) {
	  	    //alert(data);
	  	      if(data.result=='success'){
				alert("提交成功");
			//	window.close();
				api.close();
				W.reload();
	  	      }
	  	    }};
	$('#saveBtn').click(function(){
		    	$('#pageFrom').ajaxSubmit(options);
 	            return false;
	 });
	$('#closeBtn').click(function(){
		api.close();
		//window.close();
	});
	
});

function countlen1(textarea){
    var elem = event.relatedTarget || event.srcElement || event.target ||event.currentTarget;    
     if(event.keyCode!=8)
		{
		  if (textarea.value.length> 249){
		        alert("最多为250个字符,字符输入超出限制!");
		        textarea.value=textarea.value.substring(0,249);
		    }
		    return true;
	    }
}

function checking(){
		var flag = true;
	var equName = $.trim($("#EQUNAME").val());
	var shenqinren = $.trim($("#SHENQINREN").val());
	var state = $.trim($("#CHUZHI").val());
	var flowname = $.trim($("#flowname").val());
//	var lianxifangshi = $.trim($("#lianxifangshi").val());
	if(flowname ==null || flowname == "" ){
		alert("流程名称不能为空！");
		$("#flowname").focus();
		return false;
	}
	if(equName ==null || equName == "" ){
		alert("设备名称不能为空！");
		$("#equName").focus();
		return false;
	}
	if(shenqinren ==null || shenqinren == "" ){
		alert("申请人不能为空！");
		$("#shenqinren").focus();
		return false;
	}
	if(state ==null || state == "" ){
		alert("设备处置类型不能为空！");
		$("#state").focus();
		return false;
	}
	

}

//选择设备
function selectshebei(){
	var datas = window.showModalDialog("<%=request.getContextPath() %>/view/shebeifengcun_selectShebei.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=900px;dialogHeight=550px");
	if(typeof(datas) == 'undefined'){
	}else{
		var json1 = eval('(' + datas + ')');
		 document.getElementById("ID").value = json1.ID;
		 document.getElementById("EQUNAME").value = json1.EQUNAME;
		 document.getElementById("EQUGUGE").value = json1.EQUGUGE;
		 document.getElementById("EQUORGNAME").value = json1.EQUORGNAME;
		 document.getElementById("CFANGDIDIAN").value = json1.CFANGDIDIAN;
		 document.getElementById("FENGCUNJIEZHI").value = json1.FENGCUNJIEZHI;
		 document.getElementById("TIXING").value = json1.TIXING;
		 document.getElementById("YUANYIN").value = json1.YUANYIN;
		 document.getElementById("FUJIAN").value =  json1.FUJIAN;
		 document.getElementById("ZHUANGTAI").value = json1.ZHUANGTAI;
		 var a =document.getElementById("ZHUANGTAI").value;
		 document.getElementById("SHENQINREN").value = '<%=session.getAttribute("username")%>';
		 document.getElementById("EQUNO").value = json1.EQUNO
		 
	
	}
	
	

}

</script>
<style type="text/css">
body {
	background: #ffffff;
	background-image: url(images/);
}

html {
	overflow-x: hidden;
	overflow-y: hidden;
}

.formTableNew textarea {
	border: 1px solid #999;
	padding: 5px;
	width: 760px;
	-moz-border-radius: 3px;
	border-radius: 3px;
	margin-bottom: 5px;
	color: #666;
	background: url(../images/input_bg.gif) repeat-x top;
}
</style>
</head>

<body>
	<form id="pageFrom" action="" enctype="multipart/form-data"
		method="post">
		<input type="hidden" name="flowid" id="flowid" value="${flowid}">
		<input type="hidden" name="stateid" id="stateid" value="${stateid}">
		<input type="hidden" name="fengcunid" id="fengcunid" value="${requestScope.id}">
		${steptcontent} <input type="hidden" id="flag" name="flag" />
		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
			<tr>
			  <td align="right">流程名称:</td>
     		<td>
     		  	<input type="text" id="flowname" name="flowname" maxlength="50" value="设备封存流程" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"/>
     			<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
     		</td>
  			</tr>
			<tr>
				<td align="right">设备名称：</td>
				<td align="left">
				<input type="text" id="EQUNAME" maxlength="50"	name="EQUNAME"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" 	value="" /> 
					<input type="hidden"  id="ID"	maxlength="50" name="ID"   /> 
					<img src="<%=request.getContextPath()%>/images/xh.png" align="absmiddle"></img>
					<img src="<%=request.getContextPath()%>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectshebei()" />	
					</td>
				<td align="right">设备编号：</td>
				<td align="left"><input type="text" id="EQUNO"  maxlength="50"	name="EQUNO" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="" /> 
			</tr>
			<tr>
				<td align="right">规格型号：</td>
				<td align="left"><input type="text" id="EQUGUGE"  maxlength="50" name="EQUGUGE"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="" /> 	
				</td>
				<td align="right">部门：</td>
				<td align="left"><input type="text" id="EQUORGNAME"	maxlength="50" name="EQUORGNAME" 	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="" />
				</td>
			</tr>
			<tr>
				<td align="right">存放地点：</td>
				<td align="left"><input type="text" id="CFANGDIDIAN"  maxlength="50"	name="CFANGDIDIAN"	style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="" /> 
				</td>
				<td align="right">封存截止日期：</td>
				<td align="left">
				<input type="text" id="FENGCUNJIEZHI" 	name="FENGCUNJIEZHI" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="" /> 
				</td>
			</tr>
			<tr>
				<td align="right">提前提醒天数：</td>
				<td align="left">
				<input type="text"    id="TIXING" 	name="TIXING" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;"	value="" /> 
				</td>
				<td align="right">处置类型：</td>
				<td align="left">
				<select id="CHUZHI" class='fselect' name="CHUZHI" class='easyui-validatebox' style="border: 1px solid #999;padding: 5px;width:250px;height:25px;" >
 			      <option value="封存">封存</option>
			 	  <option value="启用">启用</option>
 			    </select>
 			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
				</td>
			</tr>
			<tr>
				<td align="right">申请人：</td>
				<td align="left">
				<input type="text" id="SHENQINREN"  maxlength="50" name="SHENQINREN" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="<%=session.getAttribute("username")%>" />
				<input type="hidden" id="SHENQINRENID"  maxlength="50" name="SHENQINRENID" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="<%=session.getAttribute("TDM_USER_ID")%>"/>
				</td>
				<td align="right">申请日期 :</td>
				<td align="left">
				<input type="text" id="SQDATE" maxlength="50"	name="SQDATE" style="border: 1px solid #999;padding: 5px;width: 250px;height:25px;" value="<%=DateUtilsAll.dateToStringShort(new Date()) %>" /> 
				</td>		
			</tr>
			<tr>
				<td align="right">附件：</td>
				<td align="left">
					<input type="hidden" id="FUJIAN" name="FUJIAN" />
					<jsp:include page="../fileupload/attachment.jsp?id=${requestScope.id }&column=FUJIAN&show=n" ></jsp:include>
				</td>
			</tr>
			<tr>
				<td align="right">设备状态描述：</td>
				<td colspan="3">
		    	<div class="div">
					<textarea rows="5" cols="100" id="ZHUANGTAI" name="ZHUANGTAI" onkeydown="countlen1(this);" style="width: 250px;"></textarea>
				</div>
				</td>
			</tr>
			<tr>
				<td align="right">原因描述：</td>
				<td colspan="3">
		    	<div class="div">
					<textarea rows="5" cols="100" id="YUANYIN" name="YUANYIN" onkeydown="countlen1(this);" style="width: 250px;"></textarea>
				</div>	
		    	</td>
			</tr>
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
			<tr>
				<td align="center">
				<input id="saveBtn" type="button"value="提 交" class="form_bt_orange" />
				 <input type="button" id="closeBtn" value="取 消" class="form_bt_grey" /></td>
			</tr>
		</table>
		<!--表单结束-->
	</form>
</body>
</html>
